package com.jwt.demo.sys.web;


import com.jwt.demo.Result;
import com.jwt.demo.base.BaseController;
import com.jwt.demo.base.PassToken;
import com.jwt.demo.base.UserLoginToken;
import com.jwt.demo.sys.entity.User;
import com.jwt.demo.sys.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 林武杰
 * @since 2021-09-27
 */
@RestController
@RequestMapping("/sys/user")
@Api(value = "用户管理",tags = "用户管理")
public class UserController extends BaseController {

    @Autowired
    private UserService userService;

    @ApiOperation("登录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "username",value = "用户名",required = true),
            @ApiImplicitParam(name = "password",value = "密码",required = true)
    })
    @PostMapping("/login")
    @PassToken
    public Result login(User user){
        return Result.success(userService.login(user));
    }

    @ApiOperation("获取信息")
    @PostMapping("/getMessage")
    public Result getMessage(){
        return Result.success("登录成功");
    }

}

